package huawei.js2025;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 发现新词的数量
 */
public class Question27 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String content = sc.nextLine();
        String word = sc.nextLine();

        char[] wordArr = word.toCharArray();
        Arrays.sort(wordArr);

        int count = 0;
        for (int i = 0; i < content.length() - word.length() + 1; i++) {
            char[] subCharArr = content.substring(i, i + word.length()).toCharArray();
            Arrays.sort(subCharArr);

            boolean completeEq = true;
            for (int j = 0; j < subCharArr.length; j++) {
                if(wordArr[j] != subCharArr[j]){
                    completeEq = false;
                    break;
                }
            }
            if(completeEq){
                count += 1;
            }
        }

        System.out.println(count);
    }

}
